package com.example.springapp.control;


import com.example.springapp.service.UserService;
import com.google.gson.JsonObject;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

// finduser?uid=10
@Controller
public class UserControl {
    @Autowired
    private UserService userService;

    // getUserCount/
    @RequestMapping("/getUserCount")
    @ResponseBody
    public String DogetUserCount(){
        System.out.println("call userService: " + userService);
        int count = userService.getUserCount();
        JsonObject jo = new JsonObject();
        jo.addProperty("count",count);

        ComboPooledDataSource a;

        return jo.toString();
    }
}
